<?php

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

//--------- START EDIT HERE--------------------

module_load_include('inc', 'fedora_repository', 'api/fedora_item');

$pid = "research:abc100";
$name = "Document ABC 100";

fedora_item::ingest_new_item($pid, 'A', $name, 'Admin');

$item = new fedora_item($pid);

$item->add_datastream_from_url('http://www.criticalcarethai.org/pdf/46/lesson23.pdf','OBJ','mypdf','application/pdf','M');
$item->add_datastream_from_url('http://blyt.net/phxslides/icon_takeshigondo.jpg','TN','tn','image/jpeg','M');
//$item->add_datastream_from_url('<open><dc:name>Research</dc:name></open>','OPENSCHOLAR','OP','text/xml','M');

$item->add_relationship('fedora:isMemberOfCollection','info:fedora/csim:research_collection');
$item->add_relationship('fedora-model:hasModel','info:fedora/csim:researchCModel', 'info:fedora/fedora-system:def/model#');

$item = new fedora_item($pid);
$dc = $item->get_datastream_dissemination('DC');
$ext = $item->get_datastream_dissemination('RELS-EXT');
print htmlspecialchars($dc);
print "<br/>--------------------<br/>";
print htmlspecialchars($ext);


//$item->add_datastream_from_url('http://www.iamsell.com/icon/Blue-Kikyo-icon.jpg','TN','tn','image/jpeg','M');
//----------END EDIT HERE -------------------


$return = menu_execute_active_handler();

// Menu status constants are integers; page content is a string.
if (is_int($return)) {
  switch ($return) {
    case MENU_NOT_FOUND:
      drupal_not_found();
      break;
    case MENU_ACCESS_DENIED:
      drupal_access_denied();
      break;
    case MENU_SITE_OFFLINE:
      drupal_site_offline();
      break;
  }
}
elseif (isset($return)) {
  // Print any value (including an empty string) except NULL or undefined:
  print theme('page', $return);
}
drupal_page_footer();